import { action, computed, observable, runInAction } from "mobx";
import request from "../../request/Request";

/**
 * 用户信息
 */
export class User {
  @observable public user: string = "";

  @computed get userInfo(): string {
    return this.user + "userInfo";
  }

  @action public getUserInfo = () => {
    this.user = "#111111"
  };

  /** 获取数据 */
  @action public getData = async () => {
    const data = await request.get("/dictItem/selectOne",{params:{itemId:1}})
    runInAction(() => {
      this.user = JSON.stringify(data.data);
    })
  }
}
